/*
 * Things to highlight in the example:
 * 1. always declare return types for methods, especially when defining methods for a public API
 */

package helloscala.practise.chapter2

import java.util.ArrayList

object ReturnType {
  def returnString1 = {
    "String returned"
  }

  def returnString2(strings: List[String]) = {
    if (strings.length == 0)
      List(0)
    else
      strings.mkString(",")
  }

  def returnString3(strings: ArrayList[String]) = {
    if (strings.size() == 0)
      List(0)
    else
      strings.toArray
  }

  def returnString4(strings: ArrayList[String]): Array[Object] = {
    if (strings.size() == 0)
      Array(new String("0"))
    else
      strings.toArray
  }
}
